define([],function(){
	return{
		 get:function(url, fn){
			//建立ajax对象
			var xhr;
			if(window.XMLHttpRequest){
				xhr = new XMLHttpRequest();
			}else{
				xhr = new ActiveXObject("Msxml2.XMLHTTP");
			}
			//建立连接
			xhr.open("GET", url, true);
			//发送请求
			xhr.send();
			//接收响应
			xhr.onreadystatechange = function(){
				if(	xhr.readyState == 4 && xhr.status == 200 ){
					if( fn ){
						fn(xhr.responseText);//回调函数
					}
				}
			}	
		},
		
		post:function (url, arg, fn){	
			//建立ajax对象
			var xhr;
			if(window.XMLHttpRequest){
				xhr = new XMLHttpRequest();
			}else{
				xhr = new ActiveXObject("Msxml2.XMLHTTP");
			}
			//建立连接
			xhr.open("POST", url, true);
			//发送请求
			xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			xhr.send(arg);
			//接收响应
			xhr.onreadystatechange = function(){
				if(	xhr.readyState == 4 && xhr.status == 200 ){
					if( fn ){
						fn(xhr.responseText);//回调函数
					}
				}
			}	
		}
	}
});
